package com.yun.zf.system.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yun.zf.common.app.domain.SysCouponReceive;
import com.yun.zf.common.app.dto.center.MyCouponListDto;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * 优惠券领取记录表 Mapper 接口
 * </p>
 *
 * @author cj
 * @since 2021-05-31
 */
public interface SysCouponReceiveMapper extends BaseMapper<SysCouponReceive> {

    @Select("<script>" +
            "SELECT cr.id,cr.coupon_id,cr.user_status,cr.r_start_time  ,cr.r_end_time ,c.title,c.subtitle,c.with_amount,c.used_amount,c.type,c.discount,c.description from sys_coupon_receive cr LEFT JOIN sys_coupon c on cr.coupon_id= c.id \n" +
            " WHERE cr.user_id =#{userId} " +
            "</script>")
    public List<MyCouponListDto> getUserCoupon(Long userId);
}
